//
//  MYReplenishmentListTableCell.m
//  MiYuan_iOS
//
//  Created by zhangyongbing on 2018/5/9.
//  Copyright © 2018年 zhangyongbing. All rights reserved.
//

#import "MYReplenishmentListTableCell.h"

@interface MYReplenishmentListTableCell()
@property (nonatomic,weak) IBOutlet   UIImageView     *imgIcon;
@property (nonatomic,weak) IBOutlet   UILabel         *labTitle;
@property (nonatomic,weak) IBOutlet   UILabel         *labNumber;

@end;

@implementation MYReplenishmentListTableCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    CGColorRef color = [UIColor colorWSHHFromHexString:@"#F1F1F1"].CGColor;
    [self.imgIcon.layer setMasksToBounds:YES];
    [self.imgIcon.layer setCornerRadius:2]; //设置矩形四个圆角半径
    [self.imgIcon.layer setBorderWidth:1]; //边框宽度
    [self.imgIcon.layer setBorderColor:color];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setDataToViewWithDictionary:(NSDictionary *)dic
{
    NSString *goodsName = [NSString stringWithFormat:@"%@",[dic objectForKey:@"goodsName"]];
    if ([goodsName stringIsValid]) {
        [self.labTitle setText:goodsName];
    }
    else{
        [self.labTitle setText:@"农夫山泉550ml （瓶）"];
    }
    NSString *number = [NSString stringWithFormat:@"%@",[dic objectForKey:@"total"]];
    if ([number stringIsValid]) {
        [self.labNumber setText:number];
    }
    else{
        [self.labNumber setText:@""];
    }

    NSString *imgurl =[NSString stringWithFormat:@"%@",[dic objectForKey:@"picture"]];
    if ([imgurl stringIsValid]) {
        [self.imgIcon sd_setImageWithURL:[NSURL URLWithString:imgurl] placeholderImage:[UIImage imageNamed:@"deafultgood"]];
    }
    else
    {
        [self.imgIcon setImage:[UIImage imageNamed:@"deafultgood"]];
    }
}

@end
